<?php
include '../../../wp-blog-header.php';
$coupon_id = $_POST['coupon_id'];
$columns_coupon['coupon_codes'] = $_POST['coupon_codes'];
$columns_coupon['exhausted_coupons'] = $_POST['exhausted_coupons'];
$columns_coupon['coupon_users'] = $_POST['coupon_users'];
$columns_coupon = pods_sanitize($columns_coupon);

$api = new PodAPI();
$params_coupons = array('datatype' => 'coupons', 'tbl_row_id' => $coupon_id, 'columns' => $columns_coupon);
$api->save_pod_item($params_coupons);


$users_id = $_POST['user_id'];
$columns_users['coupon_codes'] = $_POST['users_coupon_codes'];
$params_coupons = array('datatype' => 'users', 'tbl_row_id' => $users_id, 'columns' => $columns_users);
$api->save_pod_item($params_coupons);
/*
$file = 'D:/wamp/www/buzzr/buzzr_op.html';

  $str1 = print_r($codes, true);
  //$str2 = print_r($campaign_ids, true);
  //$str3 = print_r($params, true);	
	$podLinks = $str1."<br />".$str2;
	$fileHandle = fopen($file, 'w') or die("can't open file");


	if (is_writable($file))
	{
	  // Write $pod_links to our opened file.
	  if (fwrite($fileHandle, $podLinks) === FALSE)
		{
			echo "Cannot write to file ($filename)";
			exit();
	  }
		echo "Success, wrote ($podLinks) to file ($file)";
		fclose($fileHandle);
	}
	else
	{
		echo "The file $filename is not writable";
	}

echo $codes;
*/
?>

